package cn.xiaobai.j2exe.consts;


import com.badlogicgames.packr.PackrConfig;

import static com.badlogicgames.packr.PackrConfig.Platform;


/**
 * 系统类型枚举
 *
 * @Author yangdaji
 * @Date 2023/12/26
 * @PackageName cn.xiaobai.j2exe.consts
 * @ClassName SysType
 */
public enum SysType {

    Windows64("windows64", Platform.Windows64),
    Linux64("linux64", Platform.Linux64),
    MacOS("mac", Platform.MacOS);

    private String desc;

    private Platform type;


    SysType(String desc, Platform type) {
        this.desc = desc;
        this.type = type;
    }

    public static SysType byDesc(String desc) {
        for (SysType value : values()) {
            if (value.desc.equalsIgnoreCase(desc)) {
                return value;
            }
        }
        return null;
    }

    public static PackrConfig.Platform toType(String desc) {
        for (SysType value : values()) {
            if (value.desc.equalsIgnoreCase(desc)) {
                return value.getType();
            }
        }
        return null;
    }

    public static String toType(PackrConfig.Platform desc) {
        if (desc == null) {
            return null;
        }
        return desc.name();
    }


    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Platform getType() {
        return type;
    }

    public void setType(Platform type) {
        this.type = type;
    }
}